// import {createStore,combineReducers,applyMiddleware} from 'redux'
import {createStore,combineReducers,applyMiddleware} from './myRedux'
import {logger,reduxThunk} from './middle'
function count(state={
  count:100
},action){
  switch (action.type) {
    case 'add':
      return {
        ...state,
        count:state.count + action.num
      }
    case 'minus':
      return {
        ...state,
        count:state.count - action.num
      }
  
    default:
      return {
        ...state
      }
  }  
}
function color(state,action){
  state = state || {color:'red'}
  return {
    ...state,
    color:action.col || 'red'
  }
}
let rootReducer = combineReducers({
  countReducer:count,
  colorReducer:color
})

let store = createStore(rootReducer,applyMiddleware(logger,reduxThunk))
// let store = applyMiddleware(logger)(createStore)(rootReducer)
export  default store